<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>商品活动管理</title>
    <link rel="shortcut icon" href="favicon.ico">
    <script src="../../res/js/comm.js?v=1.26.0"></script>
    <!--写公共的css文件-->
    <link href="../../res/plugins/bootstrap/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="../../res/plugins/bootstrap/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="../../res/plugins/bootstrap/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
    <link href="../../res/plugins/bootstrap/css/animate.min.css" rel="stylesheet">
    <link href="../../res/plugins/bootstrap/css/style.min862f.css?v=4.1.0" rel="stylesheet">
    <link rel="stylesheet" href="../../res/plugins/layerui/layui/css/layui.css" media="all">
    <!--共用的js文件-->
    <!--openx 控件,远程地址：https://openx.yifengx.com/js/openx.js-->
    <script src="../../res/js/openx.js"></script>
    <!--表格控件-->
    <script src="../../res/plugins/bootstrap/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
    <script src="../../res/plugins/bootstrap/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
    <script src="../../res/plugins/bootstrap/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
    <script src="../../res/plugins/bootstrap/js/plugins/bootstrap-table/table-export/bootstrap-table-export.js"></script>
    <script src="../../res/plugins/bootstrap/js/plugins/bootstrap-table/table-export/tableExport.js"></script>
    <script src="../../res/plugins/chosen/js/chosen.jquery.js"></script>
    <!--弹出层控件-->
    <script src="../../res/plugins/layerui/layer/layer.js"></script>
    <!--模版控件-->
    <script src="../../res/plugins/layerui/layer/laytpl.js"></script>

    <!--美化滚动条 参考：http://manos.malihu.gr/jquery-custom-content-scroller -->
    <script src="../../res/js/utils.js"></script>
    <script src="../../res/plugins/layerui/layui/layui.js" charset="utf-8"></script>
    <link href="../../res../res/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css" rel="stylesheet">

</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="panel panel-info">
        <div class="panel-heading"><i class="fa fa-info-circle"></i>商品活动管理</div>
        <div class="panel-body">
            <div class="ibox-query">
                <form id="queryForm" method="post" class="form-horizontal">
                    <div class="form-group">
                        <label class="col-sm-1 control-label">顶级渠道</label>
                        <div class="col-sm-2" >
                            <select id="queryTopChannelCode" name="queryTopChannelCode" class="form-control" ></select>
                        </div>
                        <label class="col-sm-1 control-label">活动类型</label>
                        <div class="col-sm-2">
                            <select  name="activityType" style="width: 100%;" class="form-control">
                                <option value="">请选择</option>
                                <option value="3">单品买赠</option>
                            </select>
                        </div>
                        <label class="col-sm-1 control-label">活动名称</label>
                        <div class="col-sm-2">
                            <input name="activityName" class="form-control" type="text">
                        </div>

                        <label class="col-sm-1 control-label">活动状态</label>
                        <div class="col-sm-2">
                            <select  name="activityStatus" style="width: 100%;" class="form-control">
                                <option value="">请选择</option>
                                <option value="PENDING">待执行</option>
                                <option value="RUNNING">进行中</option>
                                <option value="FINISHED">已结束</option>
                            </select>
                        </div>

                    </div>

                    <div class="form-group">

                        <label class="col-sm-1 control-label">活动开始时间</label>
                        <div class="col-sm-2"><input class="layui-input" id='queryActivityStartTime' name="activityStartTime"  placeholder="活动开始时间" type="text" readonly onclick="layui.laydate({elem: this,isclear:false, istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"> </div>

                        <label class="col-sm-1 control-label">活动结束时间</label>
                        <div class="col-sm-2"><input class="layui-input" id='queryActivityEndTime' name="activityEndTime"   placeholder="活动结束时间" type="text" readonly   onclick="layui.laydate({elem: this,isclear:false, istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"> </div>
                        <div>
                            <button style="margin-left: 60px" class="btn btn-info" onclick='$.openx.query()' type="button"><i class="glyphicon glyphicon-search"></i> 查询</button>
                            <button style="margin-left: 10px;" class="btn btn-info" onclick="resetForm()" type="button"><i class="glyphicon glyphicon-share-alt"></i> 重置  </button>
                        </div>
                    </div>
                    <div class="hr-line-dashed"></div>
                </form>
            </div>

            <div class="row row-lg">
                <div class="col-sm-12">
                    <div class="bars pull-left">
                        <button class="btn btn-warning" onclick='$.openx.insert()' type="button"><i
                                class="glyphicon glyphicon-plus"></i> 新增
                        </button>
                    </div>
                    <table id="table" data-show-export="true">
                        <thead>
                        <tr>
                            <th data-field="stats" data-checkbox="true"></th>
                            <th data-align="center" data-field="id">活动编码</th>
                            <th data-align="center" data-field="promotionCode" >促销方案编码</th>
                            <th data-align="center" data-field="activityType" data-formatter="activityType">活动类型</th>
                            <th data-align="center" data-field="activityName" >活动名称</th>
                            <th data-align="center" data-field="topChannelCode" data-formatter="topChannelFormat">顶级渠道</th>
                            <th data-align="center" data-field="status">活动状态</th>
                            <th data-align="center" data-field="enable" data-formatter="enableFormat">启用/禁用</th>
                            <th data-align="center" data-field="activityStartTime" data-formatter="createTimeFormat">活动开始时间</th>
                            <th data-align="center" data-field="activityEndTime" data-formatter="createTimeFormat" >活动结束时间</th>
                            <th data-align="center" data-field="createTime" data-formatter="createTimeFormat" >创建时间</th>
                            <th data-align="center" data-formatter="operationFormat">操作</th>
                        </tr>
                        </thead>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
</body>

<script type="text/html" id="savePromotionActivityDialog">
    <form class="form-horizontal" id="savePromotionActivityForm" lay-filter="example">
        <div style="z-index:0">
            <div style="margin: 30px 30px 0 0">
                <div class="form-group">
                    <label class="col-sm-2 control-label"><span style="color: red; ">* </span>活动名称：</label>
                    <div class="col-sm-4" style="display: flex">
                        <input name="activityName" id="activityName" class="form-control" placeholder="请输入活动名称" type="text" title="必填字段" required="true" value="{{!d.activityName ? '':d.activityName}}">
                        <label id="activity_name_tips"></label>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label"><span style="color: red; ">* </span>顶级渠道：</label>
                    <div class="col-sm-4" style="display: flex">
                        <select id="topChannelCode" name="topChannelCode" style="width: 100%;" class="form-control" onchange="changeToChannelCode(this.value)">
                        </select>
                        <label id="top_channel_tips"></label>
                    </div>
                    <label class="col-sm-2 control-label"><span style="color: red; ">* </span>子渠道：</label>
                    <div class="col-sm-4" style="display: flex">
                        <input id="channelCode" disabled name="channelCode" class="form-control" type="text" value="0个选中项">
                        <label id="channel_code_tips"></label>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label"><span style="color: red; ">* </span>方案编码：</label>
                    <div class="col-sm-4" style="display: flex">
                        <input name="promotionCode" id="promotionCode" class="form-control" placeholder="请输入方案编码" type="text" title="必填字段" required="true" value="{{!d.promotionCode ? '':d.promotionCode}}">
                        <label id="promotion_code_tips"></label>
                    </div>
                    <label class="col-sm-2 control-label"><span style="color: red; ">* </span>活动类型：</label>
                    <div class="col-sm-4" style="display: flex">
                        <select id="activityType" name="activityType" style="width: 100%;" class="form-control">
                            <option value="">请选择</option>
                            <option value="3">单品买赠</option>
                        </select>
                        <label id="activity_type_tips"></label>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label"><span style="color: red; ">* </span>活动时间：</label>
                    <div class="col-sm-3" style="display: flex">
                        <input class="layui-input" id='activityStartTime' name="activityStartTime"  placeholder="活动开始时间" type="text" readonly onclick="layui.laydate({elem: this,isclear:false, istime: true, format: 'YYYY-MM-DD 00:00:00'})">
                        <label id="activity_start_time_tips"></label>
                    </div>
                    <div class="col-sm-1" style="text-align: center;line-height: 35px">一</div>
                    <div class="col-sm-3" style="display: flex">
                        <input class="layui-input" id='activityEndTime' name="activityEndTime"   placeholder="活动结束时间" type="text" readonly   onclick="layui.laydate({elem: this,isclear:false, istime: true, format: 'YYYY-MM-DD 23:59:59'})">
                        <label id="activity_end_time_tips"></label>
                    </div>
                </div>
            </div>
            <input  name="giftGoodsList" type="hidden" value='goodsGift'/>
            <input  name="goodsList" type="hidden" value='goodsInfo'/>
            <div style="border-top: #e2e2e2 1px solid;margin: 50px 30px 0 30px"></div>
            <div style="margin: 0 30px 0 30px">
                <label style="margin: 30px 0 10px 15px">选择商品</label>
                <div class="col-sm-12">
                    <table id="goodsInfo" class="layui-table" style="text-align: center;margin: 0px">
                    <thead>
                    <tr>
                        <th data-align="center" style="text-align: center" data-field="goodsCode" width="20%">商品编码</th>
                        <th data-align="center" style="text-align: center" data-field="goodsName" width="45%">商品名称</th>
                        <th data-align="center" style="text-align: center" data-field="amount" width="15%">条件数量</th>
                        <th data-align="center" style="text-align: center" data-field="insertOrDelete" width="20%">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {{#  layui.each(d.goodsList, function(index, item){}}
                    <tr>
                        <td><input class="layui-input" name="goodsCodeValue" onblur="changeGoodsCode(this,this.parentNode.parentNode)" value={{item.goodsCode ? item.goodsCode : ''}} ></input></td>
                        <td>{{item.goodsName ? item.goodsName : ''}}</td>
                        <td><input class="layui-input" name="quantityValue" value={{item.quantity ? item.quantity : ''}}  ></input></td>
                        <td>
                            <button type="button" class="btn btn-outline btn-success btn-xs" onclick="addRowsData(this,this.parentNode.parentNode)">确认</button>
                            <button type="button" class="btn btn-outline btn-default btn-xs" onclick="deleteRowsData('goodsInfo',this.parentNode.parentNode)">删除</button>
                        </td>
                    </tr>
                    {{# }); }}
                    </thead>
                    </table>
                </div>
            </div>

            <div style="margin: 0 30px 0 30px">
                <label style="margin: 30px 0 10px 15px">选择赠品</label>
                <div class="col-sm-12">
                    <table id="goodsGift" class="layui-table" style="text-align: center;margin: 0px">
                        <thead>
                        <tr>
                            <th data-align="center" style="text-align: center" data-field="goodsCode" width="20%">商品编码</th>
                            <th data-align="center" style="text-align: center" data-field="goodsName" width="45%">商品名称</th>
                            <th data-align="center" style="text-align: center" data-field="amount" width="15%">条件数量</th>
                            <th data-align="center" style="text-align: center" data-field="insertOrDelete" width="20%">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        {{#  layui.each(d.giftGoodsList, function(index, item){}}
                        <tr>
                            <td><input class="layui-input" name="goodsCodeValue" onblur="changeGoodsCode(this,this.parentNode.parentNode)" value={{item.goodsCode ? item.goodsCode : ''}} ></input></td>
                            <td>{{item.goodsName ? item.goodsName : ''}}</td>
                            <td><input class="layui-input" name="quantityValue" value={{item.quantity ? item.quantity : ''}}  ></input></td>
                            <td>
                                <button type="button" class="btn btn-outline btn-success btn-xs" onclick="addRowsData(this,this.parentNode.parentNode)">确认</button>
                                <button type="button" class="btn btn-outline btn-default btn-xs" onclick="deleteRowsData('goodsGift',this.parentNode.parentNode)">删除</button>
                            </td>
                        </tr>
                        {{# }); }}
                        </thead>
                    </table>
                </div>
            </div>
            <div style="margin: 120px 30px 0 0">
                <div class="form-group">
                    <label class="col-sm-2 control-label">是否累积优惠：</label>
                    <div class="col-sm-8">
                        <div class="radio  radio-inline">
                            <input type="radio" name="isDefault" id="statusRadio1"  value="true" {{d.accumulation ? 'checked' : ''}}/>
                            <label for="statusRadio1">是</label>
                        </div>
                        <div class="radio radio-danger radio-inline">
                            <input type="radio" name="isDefault" id="statusRadio2"  value="false" {{d.accumulation === 'N'? 'checked' : ''}}/>
                            <label for="statusRadio2">否</label>
                        </div>
                        <label id="accumulation_tips"></label>
                    </div>
                </div>
                <div style="margin: 0 0 0 150px">
                    <p>累计优惠即商品购买数量为上方设置数量的倍数部分可享受优惠，多余的部分按原价计算;</p>
                    <p>不累计优惠即商品购买数量超过上方设置数量时该商品全部享受特价;</p>
                </div>
            </div>
        </div>
    </form>
</script>
<script src="../../res/plugins/channel/yfTopChannel.js"></script>
<script src="../../res/plugins/yifeng/select.js"></script>
<link href="../../res/plugins/channel/css/yfChannel.css" rel="stylesheet">

<script type="text/javascript">
    (function () {
        $.openx.loadScript(['../../js/goods/promotionActivity.js']);
    })();
</script>

</html>

